import 'package:flutter/material.dart';
import 'package:flutter_ncsjqz_getx/model/friend_info_entity.dart';
import 'package:flutter_ncsjqz_getx/util/open_util.dart';
import 'package:get/get.dart';

import '../../util/rong_widget.dart';
import '../private/more_info_logic.dart';

/// <summary>
/// author：zwb
/// dateTime： 2021/12/15 16:59
/// filePath： lib/page/rong_im/more_info_view.dart
/// desc: 会话设置 -> 更多信息
/// <summary>
///
class MoreInfoPage extends StatefulWidget {
  FriendInfoData? friendInfoData;
  MoreInfoPage({this.friendInfoData});
  @override
  _MoreInfoPageState createState() => _MoreInfoPageState();
}

class _MoreInfoPageState extends State<MoreInfoPage> {
  final logic = Get.put(MoreInfoLogic());

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: RongWidget.appBarWidget(title: "更多信息"),
      body: ListView(
        padding: EdgeInsets.all(0),
        children: [
          RongWidget.rowBaseWidget(
            padding: EdgeInsets.all(15),
            leftText: "出生地区",
            rightText: "${widget.friendInfoData!.location ?? ''}",
          ),
          RongWidget.rowBaseWidget(
            padding: EdgeInsets.all(15),
            leftText: "出生年月",
            rightText: "${widget.friendInfoData!.birth ?? ''}",
          ),
          RongWidget.rowBaseWidget(
            padding: EdgeInsets.all(15),
            leftText: "兴趣爱好",
            rightText: "${widget.friendInfoData!.hobby ?? ''}",
          ),
          RongWidget.rowBaseWidget(
            padding: EdgeInsets.all(15),
            leftText: "手机号码",
            rightText: "${widget.friendInfoData!.telPhone ?? ''}",
            onTap: () {
              print("打电话");
              OpenUrl.tel(widget.friendInfoData!.telPhone ?? '');
            },
          ),
          RongWidget.rowBaseWidget(
            padding: EdgeInsets.all(15),
            leftText: "邮箱",
            rightText: "${widget.friendInfoData!.userMail ?? ''}",
          ),
        ],
      ),
    );
  }

  @override
  void dispose() {
    Get.delete<MoreInfoLogic>();
    super.dispose();
  }
}
